<h1>quote</h1>
<div id="quotegen">hi: </div>
<div id="quotedeb"></div>

<script type="text/javascript">//<![CDATA[//
if(document.getElementById('quotegen')){
  var quotegen=document.getElementById('quotegen');
  var n=quotegen.innerHTML;
  quotegen.innerHTML='\n\
label: <textarea id="qlabel" rows="1" cols="23" onchange="parsequote()">hi: </textarea>\n\
<br/>message: <textarea id="qmessage" rows="1" cols="23" onchange="parsequote()">sitegeist</textarea>\n\
<br/>button label: <textarea id="qbutton" rows="1" cols="23" onchange="parsequote()"></textarea>\n\
<br/>select on hover: <input id="qhover" type="checkbox" onclick="parsequote()"/>\n\
select on click: <input id="qclick" type="checkbox" onclick="parsequote()"/>\n\
<br/><input type="button" name="gen" value="Generate quote" onclick="parsequote();"/><br/>\n\
<br/><div id="quote"></div>';
  parsequote();
}

function parsequote(){
  var qmessage=document.getElementById('qmessage');
  var qlabel=document.getElementById('qlabel');
  var qbutton=document.getElementById('qbutton');
  var qhover=document.getElementById('qhover');
  var qclick=document.getElementById('qclick');
  genquote(qmessage,qlabel,qbutton,qhover,qclick);
}

function genquote(message,label,button,click,hover){
  var el=document.getElementById('quote');
  if(el){
    if(typeof(message)=='object'){ message=message.value; }
    if(typeof(label)=='object'){ label=label.value; }
    if(typeof(button)=='object'){ button=button.value; }
    if(typeof(click)=='object'){ click=click.checked; }
    if(typeof(hover)=='object'){ hover=hover.checked; }
    var quote='<form>\n'
      +label
      +((button)?'<input type="button" class="btn" value="'+button+'" onclick="this.form.quote.select()"/>':'')
      +'\n<input type="text" name="quote" value="'+message
      +'" size="'+message.length+'"'
      +(click?' onclick="this.form.quote.select()"':'')
      +(hover?' onmousemove="this.form.quote.select()"':'')
      +'/>\n</form>';
    quote='<p/>Preview: <div style="border:1px solid red;">'+quote
      +'</div><p/>Code:<br/><textarea rows=13 cols=80 onmouseover="this.select()">'
      +quote+'</textarea>';
    el.innerHTML=quote;
  }
}
////]]></script>